package com.zdkj.subway.epm.util;/**
 * @author 陈博
 * @date 2020/2/27 0027 23:20
 */

import com.zdkj.subway.epm.entity.SwExTicketOperation;
import lombok.experimental.UtilityClass;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: zdkj
 *
 * @description: 自定义sql 分页查询条件 map类
 *
 * @author: chen
 *
 * @create: 2020-02-27 23:20
 **/
@UtilityClass
public class SelMapUtils {
    /**
     * 删除标志  0  未删除
     */
    private final Integer DEL_FLAG_0=0;

    /**
     * 获取当前时间yyyyMMddHHmmss格式字符串
     * @return
     */
    public String getDatetimeNowFormatter(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        return  formatter.format(LocalDateTime.now());
    }
    /**
     * 设置替换对应值
     * @param sw
     * @return
     */
    public Map<String,Object> getSwExTicketOperationStationExportMap(SwExTicketOperation sw){
        HashMap<String, Object> mp = new HashMap<String, Object>(16){{
            if (sw.getStationPersonName()!=null){
            put("a.STATION_PERSON_NAME",sw.getStationPersonName());
            }
            if (sw.getBackStatus()!=null) {
                put("a.BACK_STATUS", sw.getBackStatus());
            }
            put("a.DEL_FLAG",DEL_FLAG_0);
        }};
        return mp;
    }
}
